/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			PrpView.cc
  \date			june 2010
  \author		TNick

  \brief		Contains the implementation of PrpView class and related


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read ReadMe.txt and Licence.txt in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<QMouseEvent>
#include	"prpview.h"
#include	"prpmdl.h"
#include	"prptpl.h"


/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DEFINITIONS    --------------------------------------------------------- */

/*  DEFINITIONS    ========================================================= */
//
//
//
//
/*  DATA    ---------------------------------------------------------------- */


/*  DATA    ================================================================ */
//
//
//
//
/*  FUNCTIONS    ----------------------------------------------------------- */

/* ------------------------------------------------------------------------- */
PrpView::PrpView(QWidget *parent) :
		QTreeView(parent)
{

}
/* ========================================================================= */

/* ------------------------------------------------------------------------- */
void			PrpView::mousePressEvent(QMouseEvent *event)
{
	QModelIndex indexClicked = indexAt(event->pos());
	if(indexClicked.isValid())
		{
			PrpTpl*	the_item = static_cast<PrpTpl*>(indexClicked.internalPointer());
			if (the_item != NULL)
				{
					if ((the_item->isIconDec()) && (indexClicked.column() == 1))
						{
							QRect vrect = visualRect(indexClicked);
							QRect icn_rect = QRect(
									vrect.left(),
									vrect.top(),
									vrect.height(),
									vrect.height());
							if (icn_rect.contains(event->pos()))
								{
									the_item->editIcon(this, indexClicked);
									return;
								}
						}
				}
			QTreeView::mousePressEvent(event);
		}
}
/* ========================================================================= */


//void TreeView::mousePressEvent(QMouseEvent *event)
//{


//	QRect rect = /* calculate check box rectangle from vrect */;

//	if(rect.contains(event->pos()) && model()->hasChildren(indexClicked)) {
//            qDebug() << "check box clicked";
//        }
//}



/*  FUNCTIONS    =========================================================== */
//
//
//
//
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
